package com.mall.hadoop.init;

import org.apache.hadoop.conf.Configuration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.mall.untils.PropertiesUtil;

/**
 * 初始化hadoop配置信息
 * @author tgy
 *
 */
public class HadoopInit {
	public static Logger logger = LoggerFactory.getLogger(HadoopInit.class);
	private final static HadoopInit hadoopInit = new HadoopInit();

	private static Configuration conf = null;
	
	
	static {
		try{
			conf=new Configuration();
			conf.set("fs.defaultFS",PropertiesUtil.getProperties("fs.defaultFS"));
		}catch(Exception e){
			logger.info("Hadoop初始化信息出错！");
		}
	}

	
	
	/**
	 * 实例化
	 * 
	 * @return
	 * @throws Exception
	 */
	public static HadoopInit getInstance() throws Exception {
		return hadoopInit;
	}
	
	/**
	 * 得到hadoop的Configuration配置对象
	 * @return
	 */
	public static Configuration getConfig(){
		return conf;
	}
}
